﻿#ifndef URSAENCRYPT_H
#define URSAENCRYPT_H

#include "../utkcore_global.h"

#include <QByteArray>

class UTKCORE_EXPORT URSAEncrypt
{
public:
    URSAEncrypt();
    ~URSAEncrypt();

    void generateRSAKeys(int length, const QString &publicKeyFile, const QString &privateKeyFile);

    QByteArray encryptByPubkeyString(const QByteArray &message, const QByteArray &pubkey);

    QByteArray encryptByPubkeyFile(const QByteArray &message, const std::string &pub_filename);

    QByteArray encryptByPrikeyString(const QByteArray &message, const QByteArray &prikey);

    QByteArray encryptByPrikeyFile(const QByteArray &message, const std::string &pri_file);

    QByteArray decryptByPubkeyString(const QByteArray &cipher, const QByteArray &pubkey);

    QByteArray decryptByPubkeyFile(const QByteArray &cipher, const std::string &pub_filename);

    QByteArray decryptByPrikeyString(const QByteArray &cipher, const QByteArray &prikey);

    QByteArray decryptByPrikeyFile(const QByteArray &cipher, const std::string &pri_file);

    QString GetLastError();
};

#endif // URSAENCRYPT_H



